﻿<!--
// (c) Copyright Microsoft Corporation.
// This source is subject to the Microsoft Public License (Ms-PL).
// Please see http://go.microsoft.com/fwlink/?LinkID=131993 for details.
// All other rights reserved.
-->

<UserControl
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  xmlns:toolkit="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Toolkit"
  xmlns:samples="clr-namespace:System.Windows.Controls.Samples"
  x:Class="System.Windows.Controls.Samples.GlobalCalendarSample">
    <StackPanel>
        <TextBlock Text="Gregorian:" />
        <toolkit:GlobalCalendar
          SelectionMode="MultipleRange"
          HorizontalAlignment="Left" />

        <ComboBox
          x:Name="CultureOptions"
          SelectionChanged="OnCultureChanged"
          HorizontalAlignment="Left"
          Margin="0 20 0 0">
            <ComboBoxItem Content="Arabic (Egypt)" Tag="ar-EG" />
            <ComboBoxItem Content="Chinese (Simplified)" Tag="zh-Hans" />
            <ComboBoxItem Content="Czech (Czech Republic)" Tag="cs-CZ" />
            <ComboBoxItem Content="Danish (Denmark)" Tag="da-DK" />
            <ComboBoxItem Content="Dutch (Netherlands)" Tag="nl-NL" />
            <ComboBoxItem Content="English (United States)" Tag="en-US" />
            <ComboBoxItem Content="Finnish (Finland)" Tag="fi-FI" />
            <ComboBoxItem Content="French (France)" Tag="fr-FR" />
            <ComboBoxItem Content="German (Germany)" Tag="de-DE" />
            <ComboBoxItem Content="Greek (Greece)" Tag="el-GR" />
            <ComboBoxItem Content="Hebrew (Israel)" Tag="he-IL" />
            <ComboBoxItem Content="Hindi (India)" Tag="hi-IN" />
            <ComboBoxItem Content="Hungarian (Hungary)" Tag="hu-HU" />
            <ComboBoxItem Content="Indonesian (Indonesia)" Tag="id-ID" />
            <ComboBoxItem Content="Irish (Ireland)" Tag="ga-IE" />
            <ComboBoxItem Content="Italian (Italy)" Tag="it-IT" />
            <ComboBoxItem Content="Japanese (Japan)" Tag="ja-JP" />
            <ComboBoxItem Content="Korean (Korea)" Tag="ko-KR" />
            <ComboBoxItem Content="Malay (Malaysia)" Tag="ms-MY" />
            <ComboBoxItem Content="Mongolian (Cyrillic, Mongolia)" Tag="mn-MN" />
            <ComboBoxItem Content="Norwegian, Bokmål (Norway)" Tag="nb-NO" />
            <ComboBoxItem Content="Persian" Tag="fa-IR" />
            <ComboBoxItem Content="Polish (Poland)" Tag="pl-PL" />
            <ComboBoxItem Content="Portuguese (Brazil)" Tag="pt-BR" />
            <ComboBoxItem Content="Romanian (Romania)" Tag="ro-RO" />
            <ComboBoxItem Content="Russian (Russia)" Tag="ru-RU" />
            <ComboBoxItem Content="Spanish (Mexico)" Tag="es-MX" />
            <ComboBoxItem Content="Swedish (Sweden)" Tag="sv-SE" />
            <ComboBoxItem Content="Thai (Thailand)" Tag="th-TH" />
            <ComboBoxItem Content="Turkish (Turkey)" Tag="tr-TR" />
            <ComboBoxItem Content="Ukrainian (Ukraine)" Tag="uk-UA" />
            <ComboBoxItem Content="Vietnamese (Vietnam)" Tag="vi-VN" />
        </ComboBox>
        <toolkit:GlobalCalendar
          x:Name="CulturedCalendar"
          SelectionMode="MultipleRange"
          HorizontalAlignment="Left" />

        <src:SourceViewer xmlns:src="clr-namespace:System.Windows.Controls.Samples;assembly=System.Windows.Controls.Samples.Common" xmlns:sys="clr-namespace:System;assembly=mscorlib">
  <src:SourceFile Path="GlobalCalendarSample.xaml">
    <src:SourceFile.Source>
      <sys:String>&lt;!--
// (c) Copyright Microsoft Corporation.
// This source is subject to the Microsoft Public License (Ms-PL).
// Please see http://go.microsoft.com/fwlink/?LinkID=131993 for details.
// All other rights reserved.
--&gt;

&lt;UserControl
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  xmlns:toolkit="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Toolkit"
  xmlns:samples="clr-namespace:System.Windows.Controls.Samples"
  x:Class="System.Windows.Controls.Samples.GlobalCalendarSample"&gt;
    &lt;StackPanel&gt;
        &lt;TextBlock Text="Gregorian:" /&gt;
        &lt;toolkit:GlobalCalendar
          SelectionMode="MultipleRange"
          HorizontalAlignment="Left" /&gt;

        &lt;ComboBox
          x:Name="CultureOptions"
          SelectionChanged="OnCultureChanged"
          HorizontalAlignment="Left"
          Margin="0 20 0 0"&gt;
            &lt;ComboBoxItem Content="Arabic (Egypt)" Tag="ar-EG" /&gt;
            &lt;ComboBoxItem Content="Chinese (Simplified)" Tag="zh-Hans" /&gt;
            &lt;ComboBoxItem Content="Czech (Czech Republic)" Tag="cs-CZ" /&gt;
            &lt;ComboBoxItem Content="Danish (Denmark)" Tag="da-DK" /&gt;
            &lt;ComboBoxItem Content="Dutch (Netherlands)" Tag="nl-NL" /&gt;
            &lt;ComboBoxItem Content="English (United States)" Tag="en-US" /&gt;
            &lt;ComboBoxItem Content="Finnish (Finland)" Tag="fi-FI" /&gt;
            &lt;ComboBoxItem Content="French (France)" Tag="fr-FR" /&gt;
            &lt;ComboBoxItem Content="German (Germany)" Tag="de-DE" /&gt;
            &lt;ComboBoxItem Content="Greek (Greece)" Tag="el-GR" /&gt;
            &lt;ComboBoxItem Content="Hebrew (Israel)" Tag="he-IL" /&gt;
            &lt;ComboBoxItem Content="Hindi (India)" Tag="hi-IN" /&gt;
            &lt;ComboBoxItem Content="Hungarian (Hungary)" Tag="hu-HU" /&gt;
            &lt;ComboBoxItem Content="Indonesian (Indonesia)" Tag="id-ID" /&gt;
            &lt;ComboBoxItem Content="Irish (Ireland)" Tag="ga-IE" /&gt;
            &lt;ComboBoxItem Content="Italian (Italy)" Tag="it-IT" /&gt;
            &lt;ComboBoxItem Content="Japanese (Japan)" Tag="ja-JP" /&gt;
            &lt;ComboBoxItem Content="Korean (Korea)" Tag="ko-KR" /&gt;
            &lt;ComboBoxItem Content="Malay (Malaysia)" Tag="ms-MY" /&gt;
            &lt;ComboBoxItem Content="Mongolian (Cyrillic, Mongolia)" Tag="mn-MN" /&gt;
            &lt;ComboBoxItem Content="Norwegian, Bokmål (Norway)" Tag="nb-NO" /&gt;
            &lt;ComboBoxItem Content="Persian" Tag="fa-IR" /&gt;
            &lt;ComboBoxItem Content="Polish (Poland)" Tag="pl-PL" /&gt;
            &lt;ComboBoxItem Content="Portuguese (Brazil)" Tag="pt-BR" /&gt;
            &lt;ComboBoxItem Content="Romanian (Romania)" Tag="ro-RO" /&gt;
            &lt;ComboBoxItem Content="Russian (Russia)" Tag="ru-RU" /&gt;
            &lt;ComboBoxItem Content="Spanish (Mexico)" Tag="es-MX" /&gt;
            &lt;ComboBoxItem Content="Swedish (Sweden)" Tag="sv-SE" /&gt;
            &lt;ComboBoxItem Content="Thai (Thailand)" Tag="th-TH" /&gt;
            &lt;ComboBoxItem Content="Turkish (Turkey)" Tag="tr-TR" /&gt;
            &lt;ComboBoxItem Content="Ukrainian (Ukraine)" Tag="uk-UA" /&gt;
            &lt;ComboBoxItem Content="Vietnamese (Vietnam)" Tag="vi-VN" /&gt;
        &lt;/ComboBox&gt;
        &lt;toolkit:GlobalCalendar
          x:Name="CulturedCalendar"
          SelectionMode="MultipleRange"
          HorizontalAlignment="Left" /&gt;
    &lt;/StackPanel&gt;
&lt;/UserControl&gt;</sys:String>
    </src:SourceFile.Source>
  </src:SourceFile>
  <src:SourceFile Path="GlobalCalendarSample.xaml.cs">
    <src:SourceFile.Source>
      <sys:String>// (c) Copyright Microsoft Corporation.
// This source is subject to the Microsoft Public License (Ms-PL).
// Please see http://go.microsoft.com/fwlink/?LinkID=131993 for details.
// All other rights reserved.

using System;
using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;

namespace System.Windows.Controls.Samples
{
    /// &lt;summary&gt;
    /// Sample page demonstrating the GlobalCalendar.
    /// &lt;/summary&gt;
    [Sample("(1)GlobalCalendar", DifficultyLevel.Basic)]
    [Category("GlobalCalendar")]
    public partial class GlobalCalendarSample : UserControl
    {
        /// &lt;summary&gt;
        /// Initializes a new instance of the GlobalCalendarSample class.
        /// &lt;/summary&gt;
        public GlobalCalendarSample()
        {
            InitializeComponent();
            CultureOptions.SelectedIndex = 0;
        }

        /// &lt;summary&gt;
        /// Update the culture when the drop down changes.
        /// &lt;/summary&gt;
        /// &lt;param name="sender"&gt;The culture ComboBox.&lt;/param&gt;
        /// &lt;param name="e"&gt;Event arguments.&lt;/param&gt;
        [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Justification = "Attached in XAML.")]
        private void OnCultureChanged(object sender, SelectionChangedEventArgs e)
        {
            ComboBoxItem selected = CultureOptions.SelectedItem as ComboBoxItem;
            if (selected == null)
            {
                return;
            }

            CultureInfo culture = new CultureInfo(selected.Tag as string);
            CulturedCalendar.CalendarInfo = new CultureCalendarInfo(culture);
        }
    }
}</sys:String>
    </src:SourceFile.Source>
  </src:SourceFile>
  <src:SourceFile Path="GlobalCalendarSample.xaml.vb">
    <src:SourceFile.Source>
      <sys:String>' (c) Copyright Microsoft Corporation.
' This source is subject to the Microsoft Public License (Ms-PL).
' Please see http://go.microsoft.com/fwlink/?LinkID=131993 for details.
' All other rights reserved.

Imports Microsoft.VisualBasic
Imports System
Imports System.ComponentModel
Imports System.Diagnostics.CodeAnalysis
Imports System.Globalization
Imports System.Windows
Imports System.Windows.Controls

''' &lt;summary&gt;
''' Sample page demonstrating the GlobalCalendar.
''' &lt;/summary&gt;
&lt;Sample("(1)GlobalCalendar", DifficultyLevel.Basic)&gt; _
&lt;Category("GlobalCalendar")&gt; _
Partial Public Class GlobalCalendarSample
    Inherits UserControl

    ''' &lt;summary&gt;
    ''' Initializes a new instance of the GlobalCalendarSample class.
    ''' &lt;/summary&gt;
    &lt;SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors", Justification:="Setting up the sample")&gt; _
    Sub New()
        InitializeComponent()
        CultureOptions.SelectedIndex = 0
    End Sub

    ''' &lt;summary&gt;
    ''' Update the culture when the drop down changes.
    ''' &lt;/summary&gt;
    ''' &lt;param name="sender"&gt;The culture ComboBox.&lt;/param&gt;
    ''' &lt;param name="e"&gt;Event arguments.&lt;/param&gt;
    &lt;SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Justification:="Attached in XAML.")&gt; _
    Private Sub OnCultureChanged(ByVal sender As Object, ByVal e As SelectionChangedEventArgs)
        Dim selected As ComboBoxItem = TryCast(CultureOptions.SelectedItem, ComboBoxItem)
        If selected Is Nothing Then
            Return
        End If

        Dim culture As CultureInfo = New CultureInfo(TryCast(selected.Tag, String))
        CulturedCalendar.CalendarInfo = New CultureCalendarInfo(culture)
    End Sub
End Class</sys:String>
    </src:SourceFile.Source>
  </src:SourceFile>
</src:SourceViewer>
    </StackPanel>
</UserControl>